home *** CD-ROM | disk | FTP | other *** search
/ The Essential Home & Business Collection / The Essential Home & Business Collection.iso / 27 / 3 / 5 / HP22D5.ZIP / EXTERN / HORLINE.C < prev    next >
Text File  |  1991-04-16  |  1KB  |  68 lines

  1. #include "extern.h"        /* Extensions need these! */
  2.  
  3. /*
  4. ** HORLINE, call with the following syntax:
  5. **
  6. **    horline x1,x2,y,ch,attr [,<isPage>]
  7. **
  8. **        x1        column to start the line    1 <= x1 <= 80
  9. **        x2        column to end the line        x1 <= x2 <= 80
  10. **        y        row for the line        1 <= y <= screenHeight()
  11. **        ch        character to be drawn        0 <= ch <= 255
  12. **        attr        attribute with which to draw that character    0 <= attr <= 255
  13. **        <isPage>    optional parameter - TRUE if the line is to
  14. **                be drawn on the page, FALSE for the background.
  15. **                The default (if omitted) is TRUE.
  16. **
  17. ** Warning: No error checking is done to see if x1 and x2 are valid.
  18. */
  19.  
  20. horLine(int NumArgs,
  21.     HANDLE hx1,
  22.     HANDLE hx2,
  23.     HANDLE hy,
  24.     HANDLE hch,
  25.     HANDLE hattr,
  26.     HANDLE hIsPage)
  27.  
  28. {
  29.     WORD w;
  30.     int x1,x2,y;
  31.     int sz,i;
  32.     WORD *s;
  33.     BOOLEAN ispage;
  34.     BYTE buf[160];    /* this is 2 * maximumScreenWidth (which is 80) */
  35.  
  36.     if (NumArgs < 5 || NumArgs > 6) return(STOP);
  37.  
  38.     x1 = htoi(hx1);
  39.     x2 = htoi(hx2);
  40.     y = htoi(hy);
  41.  
  42.     w = (htoi(hattr) << 8) | *deref(hch);
  43.     ispage = (NumArgs == 6) ? htob(hIsPage) : TRUE;
  44.  
  45.     sz = x2 - x1 + 1;
  46.     s = (WORD *)buf;
  47.  
  48.     for (i=0;i<sz;i++) {
  49.         *s++ = w;    /* character, attribute pair */
  50.     }
  51.  
  52.     SetScreen(ispage,x1,y,x2,y,buf);
  53.  
  54.     return(STOP);
  55. }
  56.  
  57. POOL pascal Pool[] = {
  58.     {    "horLine",
  59.         horLine,
  60.         0,
  61.         HANDLER},
  62.  
  63.     {    NULL,
  64.         NULL,
  65.         0,
  66.         0}    };
  67.  
  68.